home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
307
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
2KB
Path: inforamp.net!usenet
From: pcurran@inforamp.net (Peter Curran)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: division problem
Date: Mon, 05 Feb 1996 16:44:18 GMT
Organization: PSC Enterprises
Message-ID: <4f5bbt$o41@sam.inforamp.net>
References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk> <Pine.SOL.3.90.960130150923.21923F-100000@flute> <4etjdj$fil@airdmhor.gen.nz> <mjs.823295100@hubcap> <TANMOY.96Feb3095531@qcd.lanl.gov>
Reply-To: pcurran@inforamp.net
NNTP-Posting-Host: ts44-03.tor.inforamp.net
X-Newsreader: Forte Free Agent 1.0.82
On 03 Feb 1996 16:55:31 GMT in article <TANMOY.96Feb3095531@qcd.lanl.gov>
tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) (Tanmoy Bhattacharya) wrote:
>Note cross post to comp.std.c
>In article <mjs.823295100@hubcap> mjs@hubcap.clemson.edu
>(M. J. Saltzman) writes:
><snip>
> >#if -3 / 2 == -2
><snip>
> I'm not so sure. Is there a guarantee that the division as done in
> the compiler's preprocessing phase will give the same result as the
> division done at run time? Language lawyers?
>The standard seems silent as to this: except that it says that all
>integer arithmetic is done as on longs. The interpretation of character
>constants is explicitly permitted to be different. As otherwise the
>rules of expression evaluation are quoted, I would say other
>things cannot be different ... but I doubt whether that was intended.
I asked a similar question a few years ago - can the preprocessor work in 1's
complement while the runtime system works in 2's complement. The consensus was
yes (modulo the separate question of whether a 1's complement implementation of
the arithmetic rules is really possible/practical).
--
Peter Curran pcurran@inforamp.net